package org.lilred.nzbberry.webservice;

import org.lilred.nzbberry.http.HttpRequestDispatcher;

public class SabnzbdActionClient extends SabnzbdClient {
	public void requestSucceeded(byte[] result, String contentType) {
		System.out.println("API action completed successfully: " + toString());
		System.out.println(new String(result));
	}
	
	public void pause(String id) {
		String url = getApiUrl("queue") + "&name=pause&value=" + id;
		dispatcher = new HttpRequestDispatcher(url, "GET", this);
		dispatcher.start();
	}
	
	public void pause() {
		String url = getApiUrl("pause");
		dispatcher = new HttpRequestDispatcher(url, "GET", this);
		dispatcher.start();
	}
	
	public void resumeOne(String id) {
		String url = getApiUrl("queue") + "&name=resume&value=" + id;
		dispatcher = new HttpRequestDispatcher(url, "GET", this);
		dispatcher.start();
	}

	public void move(String id, int index) {
		String url = getApiUrl("switch") + "&name=move&value=" + id + "&value2=" + index;
		dispatcher = new HttpRequestDispatcher(url, "GET", this);
		dispatcher.start();
	}

	public void delete(String id) {
		String url = getApiUrl("queue") + "&name=delete&value=" + id;
		dispatcher = new HttpRequestDispatcher(url, "GET", this);
		dispatcher.start();
	}
	
	public void addid(String id) {
		String url = getApiUrl("addid") + "&name=" + id;
		dispatcher = new HttpRequestDispatcher(url, "GET", this);
		dispatcher.start();
	}
	
	public void clearWarnings() {
		String url = getApiUrl("warnings") + "&name=clear";
		dispatcher = new HttpRequestDispatcher(url, "GET", this);
		dispatcher.start();
	}
	
	public void deleteHistory(String id) {
		String url = getApiUrl("history") + "&name=delete&value=" + id;
		dispatcher = new HttpRequestDispatcher(url, "GET", this);
		dispatcher.start();
	}
	
	public void deleteHistory() {
		String url = getApiUrl("history") + "&name=delete";
		dispatcher = new HttpRequestDispatcher(url, "GET", this);
		dispatcher.start();
	}

	public void Unpause() {
		String url = getApiUrl("resume");
		dispatcher = new HttpRequestDispatcher(url, "GET", this);
		dispatcher.start();
	}
}
